home *** CD-ROM | disk | FTP | other *** search
- /*
- ┌────────────────────────────────────────────────────────────────────────────┐
- │Title : jzfndfst │
- │Purpose : find the first matching file from a given file spec │
- │Notes: You must define a directory record from the type TDIR, defined in │
- │ in jzdirect.h │
- │Parms: │
- │ fmask - i.e. "*.*" │
- │ fattr - file attribute to use for search. use 32 for normal searches │
- │ fdta - TDIR variables │
- │ │
- │i.e. error = jzfndfst ( "*.*" , 0x20 , &dir_record ) │
- │Written by Jack Zucker - 75766,1336 301-794-5950 on 1/15/85 │
- └────────────────────────────────────────────────────────────────────────────┘
- */
- #include <jaz.h>
- #include <jzdirect.h>
- jzfndfst (fmask,fattr,fdta)
- char *fmask;
- int fattr;
- TDIR *fdta;
- {
-
- TREG wreg;
- int wdtaofs,wdtaseg;
-
- jzgetdta(&wdtaofs,&wdtaseg); /* get old dta */
-
- jzsetdta(fdta); /* set new dta */
-
- wreg.x.ds = getds();
- wreg.x.dx = (int) fmask;
- wreg.h.ah = 0x4e; /* find first matching file */
- wreg.x.cx = fattr; /* set file attribute for search */
- msdos(&wreg);
-
- jzsetdta(wdtaofs); /* conditionalize later for large model */
-
- if (wreg.x.flags & 0x0001) return(wreg.x.ax);
- else return(0); /* return 0 if no error, otherwise dos error code */
- }